<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="<?php echo $baseurl?>">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Quản lý chương trình</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Thông tin danh sách câu hỏi</h1> <span></span>
</div>
<div class="maincontent">
    <div class="contentinner content-dashboard">
    
        <a class="btn btn-primary" target="_blank" href="<?php echo $baseurl.'manage/offline-question/add-question/'?>">Thêm câu hỏi</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="text-transform: uppercase;font-size: 30px; display: inline-block; vertical-align: middle; margin-right: 20px"><?php echo $cat ? 'Nhóm '.$cat : ''?></span><span>Tổng số <?php echo $count?> câu hỏi.</span><br /><br />
        <table class="table table-bordered">
        <colgroup>
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
            <col class="con1" />
        </colgroup>
        <thead>
            <tr>
            	<th class="centeralign"><input type="checkbox" class="checkall" /></th>
                <th>Câu hỏi</th>
                <th>Nhóm</th>
                <th class="centeralign">Thao tác</th>
            </tr>
        </thead>
        <tbody>
        <?php if(!in_array($data, array(null, '', '0'))):?>
            <?php foreach($data AS $key=>$value): ?>
                <tr>
                	<td class="centeralign"><input type="checkbox" /></td>
                    <td><?php echo stripslashes(json_decode($value['content'])->question); ?></td>
                    <td>
                        <?php if(!in_array($cat, array(null, '', '0'))):?>
                            <?php echo $value['categories_id']; ?>
                        <?php else:?>
                            <a href="<?php echo $baseurl.'manage/offline-question?cat='.$value['categories_id']; ?>"><?php echo $value['categories_id']; ?></a>
                        <?php endif;?>
                    </td>
                    <td class="centeralign">
                        <a href="<?php echo $baseurl.'manage/offline-question/edit/'.$value['id']?>"><i class="icon-pencil"></i></a>
                        <a href="#del-<?php echo $value['id']?>" class="deleterow-x"><i class="icon-trash"></i></a>
                    </td>
                </tr>
            <?php endforeach;?>
            </tbody>
        </table>
        
        <div class="pagination">
            <?php echo $this->pagination->create_links();?> 
        </div>
        <?php else: ?>
            </tbody>
        </table>
        <?php endif;?>
    
    </div>
</div>
<script>

jQuery('.deleterow-x').click(function(){
    var ids = $(this).attr('href').replace("#del-", "");
	var conf = confirm('Thao tác này sẽ xóa câu hỏi. Bạn chắc chắn?');
	if(conf)
		jQuery(this).parents('tr').fadeOut(function(){
			jQuery(this).remove();
			$.ajax({
                type: "GET",
			    url: baseUrl+'manage/offline-question/delete',
                data: ({id : ids})
			});
		});
	return false;
});
</script>